home *** CD-ROM | disk | FTP | other *** search
/ Wonky Flux Batch 2019 02 / Wonky_Flux_Batch_2019-02.zip / Wonky Flux Batch 2019-02 / 071 - EXFER 4.1 4.2.dsk / EXFER.AUX.2.S next >
Text File  |  2019-02-17  |  16KB  |  388 lines

  1.                          ;**********************
  2.                          ;*                    *
  3.                          ;*    EXfer.aux.2     *
  4.                          ;*                    *
  5.                          ;**********************
  6.  
  7.                          ; Written to fix the info problems and to provide a way
  8.                          ; to 'move' files to the correct directories, the actual
  9.                          ; moving of the files will not be done, but the file info
  10.                          ; and directory entry will be moved.
  11.  
  12.                          ; This will also allow you to edit several things that
  13.                          ; were previously uneditable.
  14.  
  15.                          ; To add this to your EXfer 4.1 add a '2' command to the
  16.                          ; list in EXFER.SEG.S with something like:
  17.  
  18.                          ; if i$="2" and (info(5)) pop:link "a:exfer.aux.2"
  19.  
  20.                          ; *** I used A1: instead of D: for the download drive specifier
  21.  
  22.                          ; WARNING: I wouldn't reccomend using this if you might lose
  23.                          ;          carrier during the 'fix' routine, I have no idea
  24.                          ;          of what damage could occur.  Back-up your XV and
  25.                          ;          DV files before using this program for the first
  26.                          ;          time.
  27.           
  28.                          ; Way back when version 1.2 came out there was a doc file that
  29.                          ; showed how the files were organized, since I am attempting to
  30.                          ; put in what I thought was left out, here they are, not in it's
  31.                          ; entirety, but enough to see what's happening.
  32.  
  33.                          ;             STRUCTURE OF THE XV.# FILES
  34.                          ;             ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  35.  
  36.                          ; Filename: XV.n (were "N" is a library number)
  37.                          ; Contents: Library & download specific information
  38.                          ;   Length: Each record is 32 bytes long
  39.  
  40.                          ; Records 0 and 1 are combined to form one 64 byte record.  These
  41.                          ; 64 bytes contain information relating to the overall volume and
  42.                          ; its operating parameters:
  43.  
  44.                          ; RECORDS 0 & 1 (64 Bytes) - Library Information
  45.  
  46.                          ; OFFSET        DESCRIPTION                      PROGRAM REFERENCE
  47.                          ; ---------------------------------------------------------------
  48.                          ; Bytes  0-30:  Directory name (padded) + [CR]   BN$
  49.                          ; Bytes 31-35:  U/D drive specifier + [CR]       BF$
  50.                          ;          ^^ about, the next five bytes are after the CR
  51.                          ; Byte     36:  Access level                     B2 or BYTE(0)
  52.                          ; Byte     37:  Download level                   B3 or BYTE(1)
  53.                          ; Byte     38:  Upload level                     B4 or BYTE(2)
  54.                          ; Byte     39:  Auto-validation flag (255=True)  BYTE(3)
  55.                          ; Byte     40:  Number of entries in this file   BYTE(4)
  56.                          ; Bytes 41-42:  Librarian high & low bytes       B1 or BYTE(5)+BYTE(6)
  57.                          ; Byte     43:  Upload credit                    UM or BYTE(7)
  58.                          ; Byte     44:  Download credit                  DM or BYTE(8)
  59.                          ; Bytes 45-63:  -- Unused --
  60.  
  61.                          ; Following these first two records are file entries, which occupy
  62.                          ; records 2 up to 254:
  63.  
  64.                          ; RECORDS 2 - X (32 bytes each) - File entries
  65.  
  66.                          ; OFFSET       DESCRIPTION                       PROGRAM REFERENCE
  67.                          ; ----------------------------------------------------------------
  68.                          ; Bytes  0-15: Filename (Padded) + [CR]          F$
  69.                          ; Bytes 16-19: Filetype + [CR]                   TY$
  70.                          ; Byte     20: File validity                     BYTE(9)
  71.                          ; Bytes 21-22: File size, high & low bytes       BYTE(10)+BYTE(11)
  72.                          ; Bytes 23-24: Uploader #, high & low bytes      BYTE(12)+BYTE(13)
  73.                          ; Bytes 25-26: Description #, high & low bytes   BYTE(14)
  74.                          ; Bytes 27-28: Date file was uploaded            WHEN$
  75.                          ; Byte     29: # of times downloaded             BYTE(18)
  76.                          ; Bytes 30-31: -- Unused --
  77.  
  78.                          ; NOTE: The description allows more than 255 descriptions, but
  79.                          ;       there can be only 254 files in the library, strange...
  80.  
  81.           ready d2$
  82. prompt
  83.           on nocar goto terminate
  84.           x=(clock(2)-clock(1))/60:x$=right$("0"+str$(x),2)
  85.           if x=0 then x$="--":else if (info(5)) or (clock(1)=0) then x$="::"
  86.           free:clear key:print \"["x$"] Aux.2 ->";
  87.           if zz=1 then zz=0:goto command
  88.           if zz=3 goto command:else get i$:print chr$(8)" ";chr$(8);
  89.  
  90.                          ; check for normal command
  91.  
  92. command
  93.           push prompt
  94.           if i$="F" pop:goto fixit
  95.           if i$="M" goto moveit
  96.           if i$="E" goto edinfo
  97.           if i$="?" or i$="/" goto help
  98.           if i$="Q" pop:link "a:exfer.seg","prompt"
  99.  
  100.                          ; not a command
  101.           print " "chr$(8);:return
  102.  
  103. help
  104.           print\\'
  105. *********************
  106. *    Exfer.aux.2    *
  107. *  by David Kirsch  *
  108. *-------------------*
  109. *  F)ix info files  *
  110. *  M)ove file       *
  111. *  E)dit entry      *
  112. *  Q)uit            *
  113. *********************
  114. '\\:return
  115.  
  116.                          ; Fix the info file
  117.                          ; ~~~~~~~~~~~~~~~~~
  118.  
  119. fixit
  120.           print "Fix"
  121.           print \\"Checking entries against infos"
  122.           store "a1:var2"
  123.           on nocar:
  124.           print \"File entries = "d1$
  125.           print "Info file    = "d2$
  126.           close
  127.           ready d2$
  128.           open #1,d1$: for l=1 to byte(4):f$=""
  129.           position #1,32,l+1:input #1,f$:input #1,ty$
  130.           position #1,32,l+1,20:read #1,ram2+9,10:if f$="" next:goto fix.1
  131.           if not(byte(14)) next:goto fix.1
  132.           input #msg(byte(14)),z:input #6,i$
  133.           if f$=i$ next:goto fix.1
  134.           print l+1". "f$"  "i$
  135.           byte(14)=0:byte(15)=0:na$=f$:nb=l:close:gosub write:open #1,d1$
  136.           next
  137.  
  138.                          ; fix bad messages (info)
  139.  
  140. fix.1
  141.           close
  142.           print \\"Checking for bad infos"
  143.           for i=1to msg(0)
  144.           if not(msg(i)) next goto fix.2
  145.           input #msg(i),z:input #6,i$
  146.           if len(i$)=15 next:goto fix.2
  147.           print i
  148.           kill #msg(i):update
  149.           next
  150.  
  151.                          ; Fix the remaining infos
  152.  
  153. fix.2
  154.           print \\"Checking remaining info against entries"
  155.           for i=1to msg(0)
  156.           if not(msg(i)) next:goto fix.done
  157.           input #msg(i),z:input #6,i$
  158.           gosub read
  159.           if l=0 kill #msg(i):update:print i$" not found.":next:goto fix.done
  160.           if byte(14)=i next:goto fix.done
  161.           if byte(14) kill #msg(i):update:print i$" duplicate deleted":next:goto fix.done
  162.           byte(14)=i:byte(15)=0:na$=f$:nb=l:gosub write
  163.           print f$" added."
  164.           next
  165.  
  166. fix.done
  167.           close
  168.           recall "a1:var2":kill "a1:var2"
  169.           goto prompt
  170.  
  171.                          ; Move entry (& info) to another library
  172.                          ; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  173.  
  174. moveit
  175.           d=0:input @2 \"Move file: " i$:if i$="" return:else na$=i$
  176.           if (val(i$)) or (left$(i$,1)="#") gosub nread:l=l-1:goto move1
  177.           i$=left$(i$+chr$(32,14),15):gosub read
  178.           if not(l) goto nfile
  179.  
  180. move1
  181.           if l<0 goto nfile
  182.           kill "a1:temp":create "a1:temp":open #1,"a1:temp"
  183.           print #1,f$:print #1,ty$:for i=9 to 18:print #1,byte(i):next
  184.           d=byte(14):if d copy #msg(d),#1
  185.           close
  186.  
  187. move2
  188.           print "Copy "f$" from library "bb
  189.           input @2"   to library [?]..." i$:if i$="" return
  190.           if i$="?" goto move3:else a=val(i$)
  191.           if (a<1) or (a>255) print \"XT: "chr$(7)"That library doesn't exist":return
  192.           ob=bb:bb=a:gosub log:if bf$="" then l=bb:gosub biterr:print '
  193. XT:       'chr$(7)"That library doesn't exist":bb=ob:goto log
  194.  
  195.           i$=f$:gosub read
  196.           if l print "Duplicate file name"chr$(7):bb=ob:goto log
  197.           gosub getslt:if nb=255 gosub dfull:bb=ob:goto log
  198.           open #1,"a1:temp"
  199.           input #1,f$:input #1,ty$
  200.           for i=9 to 18: input #1,x:byte(i)=x:next:d=byte(14)
  201.           if d a=1:gosub findinfo:byte(14)=d:copy #1,#msg(d):msg(d)=255:update
  202.           close:kill "a1:temp":na$=f$:if nb<>byte(4) gosub write:else gosub update
  203.           bb=ob:goto log
  204.  
  205. move3
  206.           print screen$"XT: You may access the following..."\\s$\
  207.           open #1,"a1:xt.bitmap":read #1,ed+1,255:close
  208.           open #1,"a1:xt.volumes":for l=1 to 255
  209.           setint(1):x=peek(ed+l):if key(1) then l=255:next:goto move3.1
  210.           if x>34 next:goto move3.1
  211.  
  212.           position #1,32,l:input #1,x$
  213.           print "["right$("00"+str$(l),3)"]: "x$:next
  214.  
  215. move3.1
  216.           close:setint(""):print:clear key:goto move2
  217.  
  218.                          ; Edit the uneditable info & directory entry
  219.                          ; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  220.  
  221. edinfo
  222.           d=0:input @2 \"Edit file: " i$:if i$="" return:else na$=i$
  223.           if (val(i$)) or (left$(i$,1)="#") gosub nread:l=l-1:goto editit
  224.           i$=left$(i$+chr$(32,14),15):gosub read
  225.           if not(l) goto nfile
  226.  
  227. editit
  228.           print \"(I)nfo or (E)ntry: ";:get i$
  229.           if i$="I" or i$="i" goto edin.x
  230.           if i$="E" or i$="e" goto edentry
  231.           return
  232.  
  233. edin.x
  234.           if l<0 goto nfile:else c=byte(12)+byte(13)*256:d=byte(14)
  235.           if not(d) print xt$;chr$(7)"File has no information":return
  236.           input #msg(d),a:input #6,x$\y$\z$:copy #6,#8
  237.  
  238. edin.2
  239.           print \\"A. Uploaded by: User #"a
  240.           print "B.    Filename: "x$
  241.           print "C.    "y$
  242.           print "D.    "z$
  243.           print \"A-D: " ;:input @2 i$
  244.           if i$="A" input "User #" a:goto edin.2
  245.           if i$="B" input "Filename: " x$:goto edin.2
  246.           if i$="C" input "Uploader: " y$:y$="Uploader: "+y$:goto edin.2
  247.           if i$="D" input "Uploaded: " z$:z$="Uploaded: "+z$:goto edin.2
  248.  
  249.           print "Save (y/N): ";:get i$:if i$<>"Y" and i$<>"y" return
  250.           edit(0)
  251.           input #msg(d),i:input #6,i$\i$\i$\i$:copy #6,#8:kill #msg(d)
  252.           print #msg(d),a:print #6,x$\y$\z$\:copy #8,#6
  253.           msg(d)=255:update:close:return
  254.  
  255. edentry
  256.           print \\"A. Filename: "f$
  257.           print "B. File type: "ty$
  258.           print "C. Valid file: ";:if byte(9) print "YES": else print "NO"
  259.           print "D. Uploader # "byte(12)+byte(13)*256
  260.           print "E. Date: "when$" (updates to current date)"
  261.           print "F. Downloaded "byte(18)" times." 
  262.           print \"A-F: " ;:input @2 i$
  263.           if i$="A" input "Filename: " f$:goto edentry
  264.           if i$="B" input "File type: " ty$:goto edentry
  265.           if i$="C" byte(9)=not(byte(9)):goto edentry
  266.           if i$="D" input "Uploader #" a:byte(13)=a/256:byte(12)=a mod 256:goto edentry
  267.           if i$="E" print "Date: " date$: when$ = "x": goto edentry
  268.           if i$="F" input "Downloaded: " a:byte(18)=a:goto edentry
  269.  
  270.           print "Save (y/N): ";:get i$:if i$<>"Y" and i$<>"y" return
  271.           na$=f$:nb=l:goto write
  272.           return
  273.  
  274.                          ; SUBROUTINE - find an empty message entry
  275.  
  276. findinfo
  277.           if msg(a) then a=a+1:else d=a:return
  278.           if a>msg(0) then d=a:return
  279.           goto findinfo
  280.  
  281.                          ; Terminate connection
  282.                          ; ~~~~~~~~~~~~~~~~~~~~
  283.  
  284. terminate
  285.           byte=ram2:byte(0)=xm+(pt*8):byte(1)=1:byte(2)=cr mod 256:byte(3)=cr/256
  286.           open #1,"a1:xt.users":position #1,4,un:write #1,ram2,4:close
  287.           poke ram2,v:when$=ram+20:if v=0 then byte=ram+29:goto term.1
  288.           byte=ram+37:nibble(3)=dl/256:byte(3)=dl mod 256
  289.           nibble(4)=ul/256:byte(4)=ul mod 256
  290.  
  291. term.1
  292.           clear:recall "a:variables":kill "a:variables"
  293.           if x=13 then ul=byte(4)+nibble(4)*256:dl=byte(3)+nibble(3)*256
  294.           link "a:main.seg","termin2"
  295.  
  296.                          ; :::::::::::::
  297.                          ; directory I/O
  298.                          ; :::::::::::::
  299.  
  300.                          ; log to a library and get some dir info
  301.                          ; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  302.  
  303. log
  304.           byte=ram2:fill ram2,32,0:bf$="":z$="a1:xv."+str$(bb)
  305.           open #1,z$:input #1,bn$:input #1,bf$
  306.           read #1,ram2,9:close:b1=byte(5)+byte(6)*256
  307.           b2=1:if byte(0) then b2=flag(byte(0))
  308.           b3=1:if byte(1) then b3=flag(byte(1))
  309.           b4=1:if byte(2) then b4=flag(byte(2))
  310.           um=byte(7):dm=byte(8):lb=(un=b1)
  311.           if info(5) then lb=1:b2=1:b3=1:b4=1
  312.           d1$="a1:xv."+str$(bb):d2$="a1:dv."+str$(bb)
  313.           if bf$ ready d2$:bf$=left$(bf$,instr(":",bf$))
  314.           return
  315.  
  316.                          ; get an empty slot
  317.                          ; ~~~~~~~~~~~~~~~~~
  318.  
  319. getslt
  320.           nb=0:open #1,d1$:for l=1 to byte(4)
  321.           position #1,32,l+1:input #1,i$
  322.           if (i$="") and (nb=0) then nb=l:l=byte(4)
  323.           next:close:if not(nb) then nb=byte(4)
  324.           return
  325.  
  326.                          ; update "number of entries" counter
  327.                          ; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  328.  
  329. update
  330.           byte(4)=byte(4)+1:open #1,d1$:print #1,bn$
  331.           print #1,bf$:write #1,ram2,9:close
  332.  
  333.                          ; write a directory entry
  334.                          ; ~~~~~~~~~~~~~~~~~~~~~~~
  335.  
  336. write
  337.           open #1,d1$:position #1,32,nb+1:print #1,na$
  338.           print #1,ty$:write #1,ram2+9,10:close
  339.           z=nb:return
  340.  
  341.                          ; read a directory entry
  342.                          ; ~~~~~~~~~~~~~~~~~~~~~~
  343.  
  344. read
  345.           open #1,d1$:for l=1 to byte(4)
  346.           position #1,32,l+1:input #1,f$
  347.           if instr(i$,f$)=1 then p=l:l=byte(4):next:l=p:goto read.1
  348.           next:close #1:l=0:return
  349.  
  350. read.1
  351.           input #1,ty$:read #1,ram2+9,10:close #1
  352.           return
  353.  
  354.                          ; read a file by slot #
  355.                          ; ~~~~~~~~~~~~~~~~~~~~~
  356.  
  357. nread
  358.           if left$(i$,1)="#" then i$=mid$(i$,2)
  359.           l=val(i$):if (l<2) or (l>253) then l=0:return
  360.           open #1,d1$:position #1,32,l
  361.           input #1,f$:if f$="" close #1:l=0:return
  362.           input #1,ty$:read #1,ram2+9,10:close #1
  363.           i$=f$:if pt=2 return:else print \"[#"l"]: "i$:return
  364.  
  365.                          ; :::::::::::::::::::::::::
  366.                          ; miscellaneous subroutines
  367.                          ; :::::::::::::::::::::::::
  368.  
  369.                          ; update errant bit-map
  370.                          ; ~~~~~~~~~~~~~~~~~~~~~
  371.  
  372. biterr
  373.           open #1,"a1:xt.bitmap":read #1,ed+1,255:close
  374.           poke ed+l,255:open #1,"a1:xt.bitmap"
  375.           write #1,ed+1,255:close:open #1,"a1:xt.volumes"
  376.           position #1,32,l:print #1,chr$(13):close
  377.           return
  378.  
  379.                          ; ::::::::::::::
  380.                          ; error messages
  381.                          ; ::::::::::::::
  382.  
  383. dfull
  384.           print xt$      ;chr$(7)" Directory full...":return
  385.  
  386. nfile
  387.           print xt$      ;chr$(7)" No such file...":return
  388.